package com.ruoyi.lyy.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.lyy.domain.dto.OrderDTO;
import com.ruoyi.lyy.service.IWxPayService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author YueYang
 * Created on 2025/11/18 16:43
 * @version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/wxpay")
@RequiredArgsConstructor
public class WxPayController {

    private final IWxPayService wxPayService;

    @PostMapping("/prepay")
    public AjaxResult getPrepayInfo(@RequestBody OrderDTO orderDTO) {
        log.info("获取微信预支付信息,前端请求参数:{}", orderDTO);
        Map<String, String> map = wxPayService.getPrepayInfo(orderDTO);
        return AjaxResult.success("获取微信预支付信息成功", map);
    }

}
